package com.yc.c118s3qnzf.controller;

import com.yc.c118s3qnzf.service.BizException;
import com.yc.c118s3qnzf.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

public class MyExceptionHandler {
    @ResponseBody
    @ExceptionHandler(BizException.class)
    public Result BizExceptionHandler(BizException e){
        e.printStackTrace();
        return new Result(0,e.getMessage(),e.getData());
    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result ExceptionHandler(Exception e){
        e.printStackTrace();
        return new Result(0,"业务繁忙，请稍后再试",null);
    }
}
